/*
三人一排，五人一排，七人一排站队，已知每次站队最后一排的人数，求总人数。
输入三个整数 a b c ,a<3,b<5,c<7
输出总人数的最小值s，10<=s<=100
如果无解，输出No answer
-----------------------------
分析：方程的解必然是整数，可以找出相同的解即是所求的。
41=3a+2
41=5b+1
41=7c+6
s=3a+2 a=(s-2)/3 s=5,8,11,14,17,20,23,26,29,32,35,38,41
s=5b+1 b=(s-1)/5 s=6,11,16,21,26,31,36,41
s=7c+6 c=(s-6)/7 s=13,20,27,34,41
 */

package com.yuan.algorithms.Algorithm_1;

import java.util.Scanner;
public class 韩信点兵 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while(sc.hasNext()){
            int a,b,c;
            a = sc.nextInt();
            b = sc.nextInt();
            c = sc.nextInt();
            int sum = people(a,b,c);
            if (sum==-1) {
                System.out.println("No answer");
            } else {
                System.out.println(sum);
            }
        }
    }
    public static int people(int a,int b,int c){
        for (int i = 1; i*7+c <= 100; i++) {
            for (int j = 1; j*5+b <= 100 && j*5+b<=i*7+c; j++) {
                for (int k = 1; k*3+a <= 100 && k*3+a<=i*7+c; k++) {
                    if (k*3+a==j*5+b&&j*5+b==i*7+c) {
                        return k*3+a;
                    }
                }
            }
        }
        return -1;
    }
}
